package game.evolver;

import java.util.Iterator;
import java.util.List;

import org.jgap.Chromosome;
import org.jgap.GeneticOperator;
import org.jgap.IGeneticOperatorConstraint;
import org.jgap.Population;

public class DeckEvolverGeneticOperatorConstraint implements IGeneticOperatorConstraint {
	public boolean isValid(Population a_pop, List a_chromosomes,
			GeneticOperator a_caller) {
		Iterator it = a_chromosomes.iterator();
		int count = 0;
		while (it.hasNext()) {
			Chromosome chrom = (Chromosome) it.next();
			for (int i = 0; i < DeckEvolverMain.cardNames.length; i++) {
				int allele = ((Integer)chrom.getGene(i).getAllele());
				count += allele;
			}
		}		
		if (count<60) { 
			// add cards
		} else if (count >60) {
			// remove cards
		}
		return true;		
	}
}
